package cn.wanho.controller.studnet;

import cn.wanho.CmsUserThreadLocal.UserThreadLocal;
import cn.wanho.rvo.ResultVO;
import cn.wanho.service.CmsClassService;
import cn.wanho.service.CmsStudentService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;
import java.io.IOException;

@RestController
@RequestMapping("student")
public class StudentController {
    @Resource
    private CmsStudentService cmsStudentService;

    /**
     * 修改学生个人信息
     * @param icon
     * @param introduction
     * @return
     * @throws IOException
     */
    @PostMapping("/modifyinfo")
    public ResultVO modifyStudentSelf(MultipartFile icon, String introduction) throws IOException {
        Integer studentId= UserThreadLocal.get().getId();
        return cmsStudentService.modifyStudentSelf(icon.getBytes(), introduction, studentId);

    }


    /**
     * 查询学生个人信息
     * @return
     */
    @GetMapping("/selectMyself")
    public ResultVO selectMyself(){
        return cmsStudentService.selectMyself();
    }


    /**
     * 查看学生当前阶段和老师
     * @return
     */
    @GetMapping("/showInfo")
    public ResultVO showInfo(){
        return cmsStudentService.showInfo();
    }


}
